
package com.myshoutui;

import java.util.ArrayList;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


public class RowViewCacher {
    View base;
    TextView title;
    TextView description;
    TextView distance;
    TextView price;
    TextView yelpRating;
    TextView yelpReviewsCount;
    ImageView icon;
    ImageView firstStar;
    ImageView secondstar;
    ImageView thirdstar;
    ImageView fourthstar;
    ImageView fifthstar;

    ImageView starsIcon;
    
    private ArrayList<ImageView> mStarImages = new ArrayList<ImageView>();
    public RowViewCacher(View base) {
        this.base = base;
        getFirst();
        getSecond();
        getThird();
        getFourth();
        getFifth();
           }

    public TextView getTitle() {
        if (title == null) {
            title = (TextView) base.findViewById(R.id.storename);
        }
        return (title);
    }

    public TextView getDistance() {
        if (distance == null) {
            distance = (TextView) base.findViewById(R.id.miles);
        }
        return (distance);
    }

   /* public TextView getPrice() {
        if (price == null) {
            price = (TextView) base.findViewById(R.id.price);
        }
        return (price);
    }*/
    
    public TextView getDescription() {
        if (description == null) {
            description = (TextView) base.findViewById(R.id.storeaddress);
        }
        return (description);
    }

    public TextView getYelpReviewsCount() {
        if (yelpReviewsCount == null) {
            yelpReviewsCount = (TextView) base.findViewById(R.id.reviewcount);
        }
        return (yelpReviewsCount);
    }

    public ImageView getIcon() {
        if (icon == null) {
            icon = (ImageView) base.findViewById(R.id.storeicon);
        }
        return (icon);
    }
    public void getFirst() {
        if (firstStar == null) {
        	firstStar = (ImageView) base.findViewById(R.id.firststar);
            mStarImages.add(firstStar);
        }
    } public void getSecond() {
        if (secondstar == null) {
        	secondstar = (ImageView) base.findViewById(R.id.secondstar);
            mStarImages.add(secondstar);
        }
    } public void getThird() {
        if (thirdstar == null) {
        	thirdstar = (ImageView) base.findViewById(R.id.thirdstar);
            mStarImages.add(thirdstar);
        }
    } public void getFourth() {
        if (fourthstar == null) {
        	fourthstar = (ImageView) base.findViewById(R.id.fourthstar);
            mStarImages.add(fourthstar);
        }
    } public void getFifth() {
        if (fifthstar == null) {
            fifthstar = (ImageView) base.findViewById(R.id.fifthstar);
            mStarImages.add(fifthstar);
        }
    }
    
    public ArrayList<ImageView> getAllStarViews(){
    	return mStarImages;
    }

    /*public ImageView getStarsIcon() {
        if (starsIcon == null) {
            starsIcon = (ImageView) base.findViewById(R.id.stars_icon);
        }
        return (starsIcon);
    }*/

}
